package com.line.model.entity;

import org.springframework.format.annotation.DateTimeFormat;
import org.hibernate.annotations.DynamicInsert;
import javax.persistence.GeneratedValue;
import javax.persistence.Column;
import javax.persistence.GenerationType;
import java.util.Date;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * <p>
 * OAuth2资源授权表，中间关联表，关联授权帐号与可访问的资源。
 * </p>
 * 
 * @version 1.0
 * @author Focus
 * @since 2018-09-04
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "auth_app_res")
public class AuthAppResEntity implements java.io.Serializable {

	private static final long serialVersionUID = -1L;

	/**
	 * 主键ID，自增长；
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false, unique = true, length = 20)
	private Long id;

	/**
	 * 授权帐号ID，关联授权帐号表
	 */
	@Column(name = "app_id", nullable = false, length = 20)
	private Long appId;

	/**
	 * 资源ID，关联资源表
	 */
	@Column(name = "res_id", nullable = false, length = 20)
	private Long resId;

	/**
	 * 创建时间，仅用于维护；
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "gmt_create", nullable = false)
	private Date gmtCreate;

	/**
	 * 更新时间，仅用于维护；
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "gmt_update", nullable = false)
	private Date gmtUpdate;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getAppId() {
		return appId;
	}

	public void setAppId(Long appId) {
		this.appId = appId;
	}

	public Long getResId() {
		return resId;
	}

	public void setResId(Long resId) {
		this.resId = resId;
	}

	public Date getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Date getGmtUpdate() {
		return gmtUpdate;
	}

	public void setGmtUpdate(Date gmtUpdate) {
		this.gmtUpdate = gmtUpdate;
	}
}
